package Lab5.Monster;

import lombok.Data;

import java.util.Random;

@Data
public class Monster {
    protected String name;
    protected Random random;

    public  Monster(String name) {
        setName(name);
        setRandom(new Random());
    }

    public int attack() {
        int randomNum = this.random.nextInt(5) + 1;
        System.out.printf("%s, of type %s,attacks generically: %d points damage caused.\n", this.name, this.getClass(), randomNum);
        return randomNum;
    }

    public void move(int direction) {
        switch (direction) {
            case 1 -> System.out.println(this.name + "is moving 1step NORTH.");
            case 2 -> System.out.println(this.name + "is moving 1step EAST.");
            case 3 -> System.out.println(this.name + "is moving 1step SOUTH.");
            default -> System.out.println(this.name + "is moving 1step WEST.");
        }
    }

}
